"""
解法一: 逐词检查
"""


def solve1(s1, s2):
    s1 = list(s1)
    s2 = list(s2)
    j = 0
    for i in range(len(s1)):
        if s2[i] in s1:
            s2[i] = None
        else:
            return False
    for i in s2:
        if i is None:
            j += 1
    if j == len(s1):
        return True
    else:
        return False


"""
解法二: 排序比较
"""


def solve2(s1, s2):
    s1 = list(s1)
    s2 = list(s2)
    s1.sort()
    s2.sort()
    for i in range(len(s1)):
        if s1[i] != s2[i]:
            return False
    return True


"""
解法三: 计数比较
"""


def solve3(s1, s2):
    c1 = [0]*26
    c2 = [0]*26
    for i in range(len(s1)):
        pos = ord(s1[i]) - ord("a")
        c1[pos] += 1
    for i in range(len(s2)):
        pos = ord(s2[i]) - ord("a")
        c2[pos] += 1
    j = 0
    while j < 26:
        if c1[j] == c2[j]:
            j += 1
        else:
            return False
    return True

